package com.aspose.cells;

import java.util.ArrayList;
import java.util.Iterator;

class zaet extends zaes {
   private ArrayList b = new ArrayList();

   private String p() throws Exception {
      StringBuilder var1 = new StringBuilder();
      this.e();

      while(!this.f()) {
         if (this.m() == '/') {
            this.j();
            if (this.m() == '*') {
               this.j();

               while(!this.f()) {
                  if (this.m() == '*') {
                     this.j();
                     if (this.m() == '/') {
                        this.j();
                        break;
                     }

                     this.j();
                  } else {
                     this.j();
                  }
               }
            }
         } else if (this.m() != '.' && this.m() != 0 && this.m() != '\r' && this.m() != '\n' && this.m() != '\t') {
            if (this.m() == '{') {
               this.j();
               break;
            }

            var1.append(this.m());
            this.j();
         } else {
            this.j();
         }
      }

      this.e();
      return com.aspose.cells.b.a.zr.a(var1).trim();
   }

   public ArrayList n() throws Exception {
      while(true) {
         if (!this.f()) {
            String var1 = this.p();
            if (!var1.equals("")) {
               if (this.m() == '}') {
                  this.j();
                  continue;
               }

               zaes var2 = new zaes(var1);
               String var3 = this.g();

               for(String var4 = this.h(); var3 != null && var4 != null; var4 = this.h()) {
                  if (var3.toLowerCase().indexOf("mso-number-format") == -1 && var4.indexOf(";") != -1) {
                     if (var4.indexOf(":") == -1) {
                        var2.a(var3, var4);
                     } else {
                        String[] var5 = com.aspose.cells.b.a.zv.d(var4, new char[]{';'});
                        var2.a(var3, var5[0]);

                        for(int var6 = 1; var6 < var5.length; ++var6) {
                           int var7 = var5[var6].indexOf(":");
                           if (var7 != -1) {
                              String var8 = var5[var6].substring(var7 + 1);
                              String var9 = var5[var6].substring(0, 0 + (var5[var6].length() - var8.length() - 1));
                              var2.a(var9.trim(), var8.trim());
                           }
                        }
                     }
                  } else {
                     var2.a(var3, var4);
                  }

                  this.e();
                  if (this.m() == '}') {
                     this.j();
                     break;
                  }

                  var3 = this.g();
               }

               com.aspose.cells.b.a.a.ze.a(this.b, (Object)var2);
               continue;
            }
         }

         this.o();
         return this.b;
      }
   }

   private ArrayList b(String var1) {
      Iterator var2 = this.b.iterator();

      zaes var3;
      do {
         if (!var2.hasNext()) {
            return null;
         }

         var3 = (zaes)var2.next();
      } while(!var3.l().equals(var1));

      return var3.d();
   }

   public void o() {
      Iterator var1 = this.b.iterator();

      label35:
      while(var1.hasNext()) {
         zaes var2 = (zaes)var1.next();
         new ArrayList();
         ArrayList var3 = (ArrayList)var2.d().clone();
         Iterator var4 = var3.iterator();

         while(true) {
            zaeo var5;
            do {
               if (!var4.hasNext()) {
                  continue label35;
               }

               var5 = (zaeo)var4.next();
            } while(!var5.a().equals("mso-style-parent"));

            var2.d().remove(var5);
            new ArrayList();
            ArrayList var6;
            if (!var2.l().equals("td") && var5.b().equals("style0")) {
               var6 = this.b("td");
            } else {
               var6 = this.b(var5.b());
            }

            if (var6 != null) {
               this.a(var2.d(), var6);
            }
         }
      }

   }

   private void a(ArrayList var1, ArrayList var2) {
      Iterator var3 = var2.iterator();

      while(var3.hasNext()) {
         zaeo var4 = (zaeo)var3.next();
         if (!this.a(var1, var4)) {
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var4);
         }
      }

   }

   private boolean a(ArrayList var1, zaeo var2) {
      if (var2.a().toLowerCase().equals("border") && var2.b().toLowerCase().equals("none") && this.a(var1)) {
         return true;
      } else {
         Iterator var3 = var1.iterator();

         zaeo var4;
         do {
            if (!var3.hasNext()) {
               return false;
            }

            var4 = (zaeo)var3.next();
         } while(!var4.a().equals(var2.a()));

         return true;
      }
   }

   private boolean a(ArrayList var1) {
      Iterator var2 = var1.iterator();

      zaeo var3;
      do {
         if (!var2.hasNext()) {
            return false;
         }

         var3 = (zaeo)var2.next();
      } while(var3.a().toLowerCase().indexOf("border") == -1);

      return true;
   }
}
